#include "../include/Equation.h"

#define V 12.4
#define L 10
#define r 1

double f(double h)
{
    return V - L * (0.5 * PI * r * r - r * r * asin(h / r) - h * pow(r * r - h * h, 0.5));
}

double g(double h)
{
    return 2 * L * pow(r * r - h * h, 0.5);
}

int main()
{
    cout << "(1):" << endl;
    Bisection first_solver(f);
    cout << first_solver.solve(0, 1) << endl;
    cout << f(first_solver.solve(0, 1)) << endl;

    cout << endl;
    cout << "(2):" << endl;
    Newton second_solver(f, g);
    cout << second_solver.solve(0, 1) << endl;
    cout << f(second_solver.solve(0, 1)) << endl;

    cout << endl;
    cout << "(1):" << endl;
    Secant third_solver(f);
    cout << third_solver.solve(0, 1) << endl;
    cout << f(third_solver.solve(0, 1)) << endl;

    cout << endl;
    double depth = r - first_solver.solve(0, 1);
    cout << "depth:" << depth << endl;

    return 0;
}